<template>
	<view>
		<view class="my_intro u-rela margin_auto">
			<view class="ava_img va_m">
				<u-avatar class="dis_blo margin_auto u-margin-bottom-20" size="100" :src="userinfo.avatar"></u-avatar>
			</view>
			<view class="intro_con va_m">
				<view class="u-font-35">{{userinfo.nickname}}</view>
				<view>部门：{{userinfo.depart}} | 工号：{{userinfo.job_no}}</view>
				
			</view>
			<view class="u-abso setting_con" @click="tosetting">
				<u-icon class="u-margin-right-10" color="#fff" name="setting" size="35rpx"></u-icon>
				<text>设置</text>
			</view>
		</view>
		<view class="responsible_con u-padding-20">
			<text class="u-font-30 r_title">更多信息</text>
			<view class="more_con u-padding-20 shadow_border">
				<view class="u-rela">
					<text class="u-abso pos_left">公司</text>
					<text class="u-abso pos_right title_con">{{userinfo.company}}</text>
				</view>
				<view class="u-rela">
					<text class="u-abso pos_left">职务</text>
					<text class="u-abso pos_right title_con">{{userinfo.post}}</text>
				</view>
				<view class="u-rela">
					<text class="u-abso pos_left">电话</text>
					<text class="u-abso pos_right title_con">{{userinfo.phone}}</text>
				</view>
			</view>
		</view>
		
		<view class="responsible_con u-padding-20">
			<text class="u-font-30 r_title">我的</text>
			<view class="shadow_border">
				<view class="type_list" @click="myintro">
					<image src="../../static/book.png" mode=""></image>
					<text>我的档案</text>
				</view>
				<view class="type_list u-rela" @click="tomessageCenter">
					<image  src="https://admin.gslhzhwy.com/upload/9a/77b79e1b996f358182d7c164614eaa.png" mode="heightFix"></image>
					<text>通知公告</text>
				</view>
				<view class="type_list" @click="tojobLog">
					<image src="../../static/job_rz.png" mode=""></image>
					<text>工作日志</text>
				</view>
				<view class="type_list u-rela u-margin-top-30" v-if="type==3 || type==1" @click="tovisitorjobs">
					<image src="https://admin.gslhzhwy.com/upload/4a/4237fa77bc09cd67629d30776cfdc9.png" mode=""></image>
					<text>访客工单</text>
					<text v-if="noticenumber.visit" class="u-abso count_con">{{noticenumber.visit}}</text>
				</view>
				<view class="type_list u-rela" v-if="type==5 || type==1" @click="torepairjobs">
					<image src="https://admin.gslhzhwy.com/upload/4a/4237fa77bc09cd67629d30776cfdc9.png" mode=""></image>
					<text>维修工单</text>
					<text v-if="noticenumber.repair" class="u-abso count_con">{{noticenumber.repair}}</text>
				</view>
				<view class="type_list u-rela" v-if="type==4 || type==1" @click="tofourHalfjobs">
					<image src="https://resourse.cnlhjt.com/upload/20220824/64ddfb3e1a52958e645ea3b52102fa61.png" mode=""></image>
					<text>四点半课堂工单</text>
					<text v-if="noticenumber.school" class="u-abso count_con">{{noticenumber.school}}</text>
				</view>
				<view class="type_list u-rela u-margin-top-30" v-if="type==4 || type==1" @click="tooldAgejobs">
					<image src="https://resourse.cnlhjt.com/upload/20220824/9823d4a86ab99ca0f509dd58e4fb99a0.png" mode=""></image>
					<text>共享养老工单</text>
					<text v-if="noticenumber.older" class="u-abso count_con">{{noticenumber.older}}</text>
				</view>
				<view class="type_list u-rela" v-if="type==4 || type==1" @click="toconveniencejobs">
					<image src="https://resourse.cnlhjt.com/upload/20220824/0918d00fb31b70c499435101b8659796.png" mode=""></image>
					<text>共享便民工单</text>
					<text v-if="noticenumber.tool" class="u-abso count_con">{{noticenumber.tool}}</text>
				</view>
				<view class="type_list u-rela u-margin-top-30" v-if="type==4 || type==1" @click="tokitchenjobs">
					<image src="https://resourse.cnlhjt.com/upload/20220824/f4d05aceca051f430a41b2e0cb727a8e.png" mode=""></image>
					<text>共享厨房工单</text>
					<text v-if="noticenumber.kitchen" class="u-abso count_con">{{noticenumber.kitchen}}</text>
				</view>
			</view>
		</view>
		<u-tabbar v-model="current" :list="vuextabbar" height="110rpx" activeColor="#0c838b" :mid-button="false"></u-tabbar>
	</view>
</template>

<script>
	import cookie from "@/util/store/cookie";
	import {getBadge} from "@/service/indexService.js";
	export default {
		data() {
			return{
				current: 0,
				userinfo:{
					avatar:'https://img2.baidu.com/it/u=3716715980,137628655&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
					nickname:'您好，请登录！',
					phone:'电话',
					name:'空',
					post:'岗位名称',
					depart:'所属部门',
					job_no:'工号',
					company:'所属公司'
				},
				type:0,
				noticenumber:{}
			}
		},
		onLoad() {
			this.type=cookie.get('type')
		},
		onShow() {
			getBadge().then(this.getBadge);
		},
		computed: {
			vuextabbar() {
				let tabbar = this.$store.state.vuex_tabbar;
				let messageNum = this.$store.state.messageNum;
				tabbar[2].count = messageNum;
				return tabbar;
			}
		},
		mounted() {
			if(this.$store.state.isLogin){
				this.userinfo=uni.getStorageSync('lifeData')
			}
			
			// console.log(this.userinfo)
		},
		methods:{
			getBadge:function(e){
				if(e.code==200){
					this.noticenumber=e.result
				}
			},
			tomessageCenter:function(){
				uni.navigateTo({
					url:'/pages/index/messageCenter'
				})
			},
			myintro:function(){
				uni.navigateTo({
					url:'/pages/mine/myIntro'
				})
			},
			tosetting:function(){
				uni.navigateTo({
					url:'/pages/mine/setting'
				})
			},
			tovisitorjobs:function(){
				uni.navigateTo({
					url:'/pages/mine/myVisitorJob'
				})
			},
			torepairjobs:function(){
				uni.navigateTo({
					url:'/pages/mine/myRepairJob'
				})
			},
			tofourHalfjobs:function(){
				uni.navigateTo({
					url:'/pages/mine/myfourHalfClass'
				})
			},
			tooldAgejobs:function(){
				uni.navigateTo({
					url:'/pages/mine/myOldAge'
				})
			},
			toconveniencejobs:function(){
				uni.navigateTo({
					url:'/pages/mine/myConvenienceJob'
				})
			},
			tokitchenjobs:function(){
				uni.navigateTo({
					url:'/pages/mine/myKitchenJob'
				})
			},
			tojobLog:function(){
				uni.navigateTo({
					url:'/pages/mine/jobLog'
				})
			},
		}
	}
</script>

<style lang="scss">
	.my_intro{
		width:95%;
		padding:40rpx 20rpx;
		border-radius: 15rpx;
		margin-top:10rpx;
		background-color: #006971;
	}
	.my_intro>view{
		color:#fff;
		display: inline-block;
	}
	.ava_img{
		padding:0 15rpx;
		text-align: center;
		margin-right:30rpx;
	}
	.setting_con{
		top:20rpx;
		right:20rpx;
	}
	.intro_con view{
		padding:7rpx 0;
	}
	.count_con{
		font-size: 20rpx;
		color:#fff;
		width:35rpx;
		height:35rpx;
		line-height: 35rpx;
		text-align: center;
		border-radius: 50%;
		top:0rpx;
		right:60rpx;
		background-color: red;
	}
	.r_title{
		display: block;
		padding:30rpx 0;
	}
	.type_list{
		display: inline-block;
		width:33%;
		font-size: 26rpx;
		text-align: center;
		padding:30rpx 10rpx;
	}
	.type_list image{
		display: block;
		width:60rpx;
		height:60rpx;
		margin:0 auto 10rpx;
	}
	.shadow_border{
		padding:30rpx 0;
		border-radius: 15rpx;
		box-shadow: 0 0 15rpx #ddd;
	}
	.more_con{
		// top:-70rpx;
		// width:95%;
		// margin:0 auto;
		// background-color: #fff;
	}
	.more_con view{
		height:60rpx;
		line-height: 60rpx;
		// padding:10rpx 0;
	}
	.title_con{
		color:#666;
	}
</style>
